<!DOCTYPE html>
<html>
<head>
  <link href="qunit/qunit.css" rel="stylesheet" type="text/css" />
  <script src="qunit/qunit.js"></script>
  <!-- Add source files here as necessary.  There are the raw source files,
  and they have not been compiled of wrapped in a closure.  Include them in the
  order that they should be included in.  If you are following the template's
  pattern, the init file MUST be loaded last. -->
  <script src="../src/ndeflibrary.const.js"></script>
  <script src="../src/ndeflibrary.core.js"></script>
  <script src="../src/ndeflibrary.module.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefAndroidAppRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefMessage.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefUriRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefTelRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefGeoRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefSocialRecord.js"></script>
  <script src="../src/submodule/ndeflibrary.NdefTextRecord.js"></script>
  <script src="../src/ndeflibrary.init.js"></script>
  <script>
  </script>
</head>
<body>
  <h1 id="qunit-header">NdefAndroidAppRecord Unit Tests</h1>
   <h2 id="qunit-banner"></h2>
   <div id="qunit-testrunner-toolbar"></div>
   <h2 id="qunit-userAgent"></h2>
   <ol id="qunit-tests"></ol>
   <div id="qunit-fixture"></div>
   <script>
   (function () {

     module('NdefAndroidAppRecord Constructor');
     
     test('NdefAndroidAppRecord constructor', function() {
     	
     	var ndefAndroidAppRecord = new NdefLibrary.NdefAndroidAppRecord();
     	
     	deepEqual(NdefLibrary.NdefAndroidAppRecord.isRecordType(ndefAndroidAppRecord),true);
        deepEqual(NdefLibrary.NdefAndroidAppRecord.isRecordType(new NdefLibrary.NdefRecord()), false);
        
     });
     
     
     test('NdefAndroidAppRecord Uri', function() {
     	
     	var ndefAndroidAppRecord = new NdefLibrary.NdefAndroidAppRecord();
        var uri = "at.nextstop.android.pro";
        ndefAndroidAppRecord.setPackageName(uri);
        
        var uri2 = ndefAndroidAppRecord.getPackageName();
        
        deepEqual(uri2, uri);
     });

	test('NdefUriRecrod Message envelope', function() {
     	
     	var ndefAndroidAppRecord = new NdefLibrary.NdefAndroidAppRecord();
        var uri = "at.nextstop.android.pro";
        ndefAndroidAppRecord.setPackageName(uri);
        var ndefMessage = new NdefLibrary.NdefMessage(ndefAndroidAppRecord);
        
        // console.log(getHexString(ndefMessage.toByteArray()));
        
        deepEqual(ndefMessage.toByteArray(),[212, 15, 23, 97, 110, 100, 114, 111, 105, 100, 46, 99, 111, 109, 58, 112, 107, 103, 97, 116, 46, 110, 101, 120, 116, 115, 116, 111, 112, 46, 97, 110, 100, 114, 111, 105, 100, 46, 112, 114, 111]);
     });

	test('NdefUriRecrod Copy', function() {
     	
     	var ndefAndroidAppRecord = new NdefLibrary.NdefAndroidAppRecord();
        var uri = "at.nextstop.android.pro";
        ndefAndroidAppRecord.setPackageName(uri);
        var ndefMessage = new NdefLibrary.NdefMessage(ndefAndroidAppRecord);
        
        var bytearray = ndefMessage.toByteArray();
        var ndefMessage2 = NdefLibrary.NdefMessage.fromByteArray(bytearray);
        deepEqual(ndefMessage2.toByteArray(), ndefMessage.toByteArray());
        deepEqual(ndefMessage2.length(), 1);
        
        var _ndefAndroidAppRecord2 = ndefMessage2.getRecords()[0];
        deepEqual(NdefLibrary.NdefAndroidAppRecord.isRecordType(_ndefAndroidAppRecord2), true);
        var ndefAndroidAppRecord2 = new NdefLibrary.NdefAndroidAppRecord(_ndefAndroidAppRecord2);
        deepEqual(ndefAndroidAppRecord2, ndefAndroidAppRecord);
        
        
     });



   } ());
   </script>
</body>
</html>
